//
//  BGMFriendTableViewCell.m
//  BGM
//
//  Created by 我要变好看 on 2018/12/23.
//  Copyright © 2018 com.alirtc.demo. All rights reserved.
//

#import "BGMFriendPhotoTableViewCell.h"
#import "Common.h"
#import "UIImageView+WebCache.h"
@interface BGMFriendPhotoTableViewCell ()
@property (nonatomic, strong)UILabel *rightLabel;
@property (nonatomic, strong)UIButton *rightBtn;
@property (nonatomic, strong)UIView *photoImageView;


@end

@implementation BGMFriendPhotoTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self != nil) {
        
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, SCREENW-15, 0.3)];
        label.backgroundColor = [UIColor grayColor];
        label.alpha = 0.3;
        [self addSubview:label];
        
        UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, 80, 55)];
        label1.text = @"个人相册";
        label1.textColor = bgmmainColor;
        [self addSubview:label1];
        
        self.rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREENW-60-150, 0, 110, 55)];
        self.rightLabel.text = @"还没有添加过照片";
        self.rightLabel.textColor = bgmgrayColor;
        self.rightLabel.textAlignment = NSTextAlignmentRight;
        self.rightLabel.font = [UIFont systemFontOfSize:13];
        [self addSubview:self.rightLabel];
        
        self.rightBtn = [[UIButton alloc]initWithFrame:CGRectMake(SCREENW-60-50, 0, 55, 55)];
        [self.rightBtn setImage:[UIImage imageNamed:@"gengduo"] forState:UIControlStateNormal];
        [self addSubview:self.rightBtn];
        
        self.photoImageView = [[UIView alloc]initWithFrame:CGRectMake(15, 55, SCREENW-60-50, 110)];
        [self addSubview:self.photoImageView];
        
        self.photoImageView.hidden = YES;
        
    }
    return self;
}
- (void)setUserPhoto:(NSArray *)array{
    self.photoImageView.hidden = NO;
    self.rightLabel.hidden = YES;
    for (int i =0; i<array.count; i++) {
        if (i>2) {
            break;
        }
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(i*100, 0, 80, 80)];
        imageView.layer.cornerRadius = 8;
        imageView.layer.masksToBounds = YES;
        imageView.contentMode = UIViewContentModeScaleAspectFit;
        [self.photoImageView addSubview:imageView];
        NSString *str = [array objectAtIndex:i];
        [imageView sd_setImageWithURL:[NSURL URLWithString:str] placeholderImage:[UIImage imageNamed:@"headImage"]];
    }
    
}



@end
